package com.vcc.core.derive.converter.transaction;

import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;

public class TypeConverter implements Converter<String> {

    private static String typeToString(String status) {
        return switch (status) {
           //AUTH
            //REVERSAL
            //REFUND
            //VERIFY
            case "AUTH" -> "授权";
            case "REVERSAL" -> "授权撤销";
            case "REFUND" -> "退款";
            case "VERIFY" -> "验证";
            default -> "未知";
        };
    }

    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }


    @Override
    public String convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration
    globalConfiguration) {
        return null;
    }


    @Override
    public WriteCellData<?> convertToExcelData(String value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(typeToString(value));
    }
}